package com.xiaowu.xblog.repository;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xiaowu.xblog.entity.SysUser;
import com.xiaowu.xblog.mapper.SysUserMapper;
import com.xiaowu.xblog.repository.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public class SysUserRepository extends BaseRepositoryImpl<SysUserMapper, SysUser> {
    // 可添加用户专属的数据访问方法

    @Transactional(rollbackFor = Exception.class)
    public SysUser findByGithubId(String githubId) {
        LambdaQueryWrapper<SysUser> eq = new LambdaQueryWrapper<SysUser>()
                .eq(SysUser::getGithubId, githubId);
        return this.getOne(eq);
    }
}
